<? 
	include('protect1.php'); 
	//$matakuliah='mk' . $reg_jurusan;
	$matakuliah='mk';
?>

<STYLE type=text/css>.blank {
	FONT-SIZE: 0px; WIDTH: 0px; HEIGHT: 0px
}
TD {
	FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
INPUT {
	FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
.present {
	FONT-WEIGHT: bold; BACKGROUND-COLOR: #dee5ec
}
.h1 {
	FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #ffffff
}
.d1 {
	COLOR: #c0c0c0
}
.link {
	FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: #ffffff; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.footer {
	FONT-WEIGHT: normal; FONT-SIZE: 10px; COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.footer1 {
	FONT-WEIGHT: bold; FONT-SIZE: 10px; BACKGROUND-IMAGE: url(chat/images/menu_b.gif); CURSOR: default; COLOR: #000000; BORDER-BOTTOM: 0px
}
.header {
	FONT-WEIGHT: bold; FONT-SIZE: 10px; BACKGROUND-IMAGE: url(chat/images/menu_h.gif); CURSOR: default; COLOR: #000000; BORDER-BOTTOM: 0px
}
.textcol {
	FONT-SIZE: 12px; COLOR: #2378d5; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
body,td,th {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 11pt;
	color: #FFFFFF;
}
body {
	background-color: #001E8C;
	background-image: url(bg.jpg);
	background-repeat: repeat;
}
a:link {
	color: #FFFFFF;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #FFFFFF;
}
a:hover {
	text-decoration: underline;
	color: #001D86;
}
a:active {
	text-decoration: none;
	color: #001C8A;
}
</STYLE>


<title>:: Daftar Kuliah ::</title><table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td bgcolor="7e96dc">&nbsp;</td>
  </tr>
  <tr>
    <td><img src="images/bannerAtas.jpg" alt="image" width="780" height="200" /></td>
  </tr>
  <tr>
    <td bgcolor="3a5db1">
	<?php
    	$sel_smt=$_GET["sel_smt"];
	$sel_periode=$_GET["sel_periode"];
	//include("banner.html");
	include("connect.php");
	$pilih=mysql_select_db("uwika_krs",$conn);
	echo "<BR>";
	echo "Berikut dibawah ini adalah daftar mata kuliah yang ditawarkan pada :";
	echo "<br>";
	echo "Semester : " . $sel_smt;
	echo "<br>";
	echo "Periode &nbsp&nbsp : " . $sel_periode;
	echo "<table width=\"90%\" border=0>";
	echo "<tr\"><td width=5%></td><td>";
	echo "<table align=center width=100% border=\"0\">";
	echo "<tr bgcolor=\"#001E8C\"><td width=5%><center><b>H A R I</b></center></td>";
	echo "<td width=12%><center><b>P U K U L</b></center></td>";
	echo "<td width=5%><center><b>K O D E</b></center></td>";
	echo "<td width=25%><center><b>N A M A &nbsp; M A T A  &nbsp; K U L I A H</b></center></td>";
	echo "<td width=5%><center><b>SKS</b></center></td></b>";
	echo "</tr>";

	//SENIN
	$sqlstr="select penawaran.recno, penawaran.kodemk, $matakuliah.nama, $matakuliah.sks, penawaran.dosen, penawaran.keterangan, penawaran.pagu, penawaran.sesi,penawaran.hari,penawaran.mulaipukul,penawaran.selesaipukul from penawaran,$matakuliah where semester='$sel_smt' and periode='$sel_periode' and penawaran.kodemk=$matakuliah.kodemk and penawaran.hari='SENIN' and penawaran.jurusan=$reg_jurusan order by penawaran.mulaipukul";
	$hasil=mysql_query($sqlstr);
	$row = mysql_fetch_row($hasil);
	$counter=1;
	do {
		list($recno,$kodemk,$nama,$sks,$dosen,$keterangan,$pagu,$sesi,$hari,$mulaipukul,$selesaipukul) = $row;
		if (empty($kodemk)) {
		echo "<BR><BR>";
		break;
		} 
		if ($counter==1) {
			echo "<tr bgcolor=\"#4585cd\"><td><center>$hari</center></td>";
		} else
			echo "<tr bgcolor=\"#4585cd\"><td><center></center></td>";
		echo "<td><center>$mulaipukul - $selesaipukul</center></td>";
		echo "<td><center><a href=\"daftar.php?recno=$recno&kodemk=$kodemk&sesi=$sesi&periode=$sel_periode&semester=$sel_smt\"> $kodemk </center></td>";
		echo "<td> $nama </td>";
		echo "<td><center> $sks </center></td>";
		echo "</tr>";
		$counter = $counter + 1;
	} while ($row=mysql_fetch_row($hasil));

	//SELASA
	$sqlstr="select penawaran.recno, penawaran.kodemk, $matakuliah.nama, $matakuliah.sks, penawaran.dosen, penawaran.keterangan, penawaran.pagu, penawaran.sesi,penawaran.hari,penawaran.mulaipukul,penawaran.selesaipukul from penawaran,$matakuliah where semester='$sel_smt' and periode='$sel_periode' and penawaran.kodemk=$matakuliah.kodemk and penawaran.hari='SELASA' and penawaran.jurusan=$reg_jurusan order by penawaran.mulaipukul";
	$hasil=mysql_query($sqlstr);
	$row = mysql_fetch_row($hasil);
	$counter=1;
	do {
		list($recno,$kodemk,$nama,$sks,$dosen,$keterangan,$pagu,$sesi,$hari,$mulaipukul,$selesaipukul) = $row;
		if (empty($kodemk)) {
		echo "<BR><BR>";
		break;
		} 
		if ($counter==1) {
			echo "<tr bgcolor=\"#7e96dc\"><td><center>$hari</center></td>";
		} else
			echo "<tr bgcolor=\"#7e96dc\"><td><center></center></td>";
		echo "<td><center>$mulaipukul - $selesaipukul</center></td>";
		echo "<td><center><a href=\"daftar.php?recno=$recno&kodemk=$kodemk&sesi=$sesi&periode=$sel_periode&semester=$sel_smt\"> $kodemk </center></td>";
		echo "<td> $nama </td>";
		echo "<td><center> $sks </center></td>";
		echo "</tr>";
		$counter = $counter + 1;
	} while ($row=mysql_fetch_row($hasil));

	//RABU
	$sqlstr="select penawaran.recno, penawaran.kodemk, $matakuliah.nama, $matakuliah.sks, penawaran.dosen, penawaran.keterangan, penawaran.pagu, penawaran.sesi,penawaran.hari,penawaran.mulaipukul,penawaran.selesaipukul from penawaran,$matakuliah where semester='$sel_smt' and periode='$sel_periode' and penawaran.kodemk=$matakuliah.kodemk and penawaran.hari='RABU' and penawaran.jurusan=$reg_jurusan order by penawaran.mulaipukul";
	$hasil=mysql_query($sqlstr);
	$row = mysql_fetch_row($hasil);
	$counter=1;
	do {
		list($recno,$kodemk,$nama,$sks,$dosen,$keterangan,$pagu,$sesi,$hari,$mulaipukul,$selesaipukul) = $row;
		if (empty($kodemk)) {
		echo "<BR><BR>";
		break;
		} 
		if ($counter==1) {
			echo "<tr bgcolor=\"#4585cd\"><td><center>$hari</center></td>";
		} else
			echo "<tr bgcolor=\"#4585cd\"><td><center></center></td>";
		echo "<td><center>$mulaipukul - $selesaipukul</center></td>";
		echo "<td><center><a href=\"daftar.php?recno=$recno&kodemk=$kodemk&sesi=$sesi&periode=$sel_periode&semester=$sel_smt\"> $kodemk </center></td>";
		echo "<td> $nama </td>";
		echo "<td><center> $sks </center></td>";
		echo "</tr>";
		$counter = $counter + 1;
	} while ($row=mysql_fetch_row($hasil));

	//KAMIS
	$sqlstr="select penawaran.recno, penawaran.kodemk, $matakuliah.nama, $matakuliah.sks, penawaran.dosen, penawaran.keterangan, penawaran.pagu, penawaran.sesi,penawaran.hari,penawaran.mulaipukul,penawaran.selesaipukul from penawaran,$matakuliah where semester='$sel_smt' and periode='$sel_periode' and penawaran.kodemk=$matakuliah.kodemk and penawaran.hari='KAMIS' and penawaran.jurusan=$reg_jurusan order by penawaran.mulaipukul";
	$hasil=mysql_query($sqlstr);
	$row = mysql_fetch_row($hasil);
	$counter=1;
	do {
		list($recno,$kodemk,$nama,$sks,$dosen,$keterangan,$pagu,$sesi,$hari,$mulaipukul,$selesaipukul) = $row;
		if (empty($kodemk)) {
		echo "<BR><BR>";
		break;
		} 
		if ($counter==1) {
			echo "<tr bgcolor=\"#7e96dc\"><td><center>$hari</center></td>";
		} else
			echo "<tr bgcolor=\"#7e96dc\"><td><center></center></td>";
		echo "<td><center>$mulaipukul - $selesaipukul</center></td>";
		echo "<td><center><a href=\"daftar.php?recno=$recno&kodemk=$kodemk&sesi=$sesi&periode=$sel_periode&semester=$sel_smt\"> $kodemk </center></td>";
		echo "<td> $nama </td>";
		echo "<td><center> $sks </center></td>";
		echo "</tr>";
		$counter = $counter + 1;
	} while ($row=mysql_fetch_row($hasil));

	//JUMAT
	$sqlstr="select penawaran.recno, penawaran.kodemk, $matakuliah.nama, $matakuliah.sks, penawaran.dosen, penawaran.keterangan, penawaran.pagu, penawaran.sesi,penawaran.hari,penawaran.mulaipukul,penawaran.selesaipukul from penawaran,$matakuliah where semester='$sel_smt' and periode='$sel_periode' and penawaran.kodemk=$matakuliah.kodemk and penawaran.hari='JUMAT' and penawaran.jurusan=$reg_jurusan order by penawaran.mulaipukul";
	$hasil=mysql_query($sqlstr);
	$row = mysql_fetch_row($hasil);
	$counter=1;
	do {
		list($recno,$kodemk,$nama,$sks,$dosen,$keterangan,$pagu,$sesi,$hari,$mulaipukul,$selesaipukul) = $row;
		if (empty($kodemk)) {
		echo "<BR><BR>";
		break;
		} 
		if ($counter==1) {
			echo "<tr bgcolor=\"#4585cd\"><td><center>$hari</center></td>";
		} else
			echo "<tr bgcolor=\"#4585cd\"><td><center></center></td>";
		echo "<td><center>$mulaipukul - $selesaipukul</center></td>";
		echo "<td><center><a href=\"daftar.php?recno=$recno&kodemk=$kodemk&sesi=$sesi&periode=$sel_periode&semester=$sel_smt\"> $kodemk </center></td>";
		echo "<td> $nama </td>";
		echo "<td><center> $sks </center></td>";
		echo "</tr>";
		$counter = $counter + 1;
	} while ($row=mysql_fetch_row($hasil));

	//SABTU
	$sqlstr="select penawaran.recno, penawaran.kodemk, $matakuliah.nama, $matakuliah.sks, penawaran.dosen, penawaran.keterangan, penawaran.pagu, penawaran.sesi,penawaran.hari,penawaran.mulaipukul,penawaran.selesaipukul from penawaran,$matakuliah where semester='$sel_smt' and periode='$sel_periode' and penawaran.kodemk=$matakuliah.kodemk and penawaran.hari='SABTU' and penawaran.jurusan=$reg_jurusan order by penawaran.mulaipukul";
	$hasil=mysql_query($sqlstr);
	$row = mysql_fetch_row($hasil);
	$counter=1;
	do {
		list($recno,$kodemk,$nama,$sks,$dosen,$keterangan,$pagu,$sesi,$hari,$mulaipukul,$selesaipukul) = $row;
		if (empty($kodemk)) {
		echo "<BR><BR>";
		break;
		} 
		if ($counter==1) {
			echo "<tr bgcolor=\"#7e96dc\"><td><center>$hari</center></td>";
		} else
			echo "<tr bgcolor=\"#7e96dc\"><td><center></center></td>";
		echo "<td><center>$mulaipukul - $selesaipukul</center></td>";
		echo "<td><center><a href=\"daftar.php?recno=$recno&kodemk=$kodemk&sesi=$sesi&periode=$sel_periode&semester=$sel_smt\"> $kodemk </center></td>";
		echo "<td> $nama </td>";
		echo "<td><center> $sks </center></td>";
		echo "</tr>";
		$counter = $counter + 1;
	} while ($row=mysql_fetch_row($hasil));

	//BEBAS
	$sqlstr="select penawaran.recno, penawaran.kodemk, $matakuliah.nama, $matakuliah.sks, penawaran.dosen, penawaran.keterangan, penawaran.pagu, penawaran.sesi,penawaran.hari,penawaran.mulaipukul,penawaran.selesaipukul from penawaran,$matakuliah where semester='$sel_smt' and periode='$sel_periode' and penawaran.kodemk=$matakuliah.kodemk and penawaran.hari='BEBAS' and penawaran.jurusan=$reg_jurusan order by penawaran.mulaipukul";
	$hasil=mysql_query($sqlstr);
	$row = mysql_fetch_row($hasil);
	$counter=1;
	do {
		list($recno,$kodemk,$nama,$sks,$dosen,$keterangan,$pagu,$sesi,$hari,$mulaipukul,$selesaipukul) = $row;
		if (empty($kodemk)) {
		echo "<BR><BR>";
		break;
		} 
		if ($counter==1) {
			echo "<tr bgcolor=\"#4585cd\"><td><center>$hari</center></td>";
		} else
			echo "<tr bgcolor=\"#4585cd\"><td><center></center></td>";
		echo "<td><center>$mulaipukul - $selesaipukul</center></td>";
		echo "<td><center><a href=\"daftar.php?recno=$recno&kodemk=$kodemk&sesi=$sesi&periode=$sel_periode&semester=$sel_smt\"> $kodemk </center></td>";
		echo "<td> $nama </td>";
		echo "<td><center> $sks </center></td>";
		echo "</tr>";
		$counter = $counter + 1;
	} while ($row=mysql_fetch_row($hasil));

	echo "</table><td width=5%></td></tr></table>";
	echo "<br>";
	echo "*) Klik pada kode mata kuliah untuk mendaftar ...";
	echo "&nbsp;";
	echo "<BR><BR>";
	$sqlstr="select sks,ips,toleransi from ips where nrp='$reg_uname'";
	$hasil=mysql_query($sqlstr);
	$row = mysql_fetch_row($hasil);
	list($sks,$ips,$toleransi) = $row;
	$sqlstr="select sum(sks) from registrasi where nrp='$reg_uname'";
	$hasil=mysql_query($sqlstr);
	$row = mysql_fetch_row($hasil);
	list($sksdlmkrs) = $row;
	if ($ips < 1.500) {
		$limitsksx = 12;
	}
	if (($ips >= 1.500) and ($ips < 1.750)) {
		$limitsksx = 14;
	}
	if (($ips >= 1.750) and ($ips < 2.000)) {
		$limitsksx = 16;
	}
	if (($ips >= 2.000) and ($ips < 2.250)) {
		$limitsksx = 18;
	}
	if (($ips >= 2.250) and ($ips < 3.000)) {
		$limitsksx = 21;
	}
	if ($ips >= 3.000) {
		$limitsksx = 24;
	}
	echo "<table width=\"90%\">";
	echo "<tr><td width=5%></td>";
	echo "<td><table width=\"90%\">";
	$sqlstr="SELECT biodata.nama FROM security,biodata where security.username='$reg_uname' and biodata.nrp=security.username";
	$hasil=mysql_query($sqlstr);
	$row = mysql_fetch_row($hasil);
	list($namamhs) = $row;
	/*
		mengubah disini YULIUS H
		untuk siswa angkatan baru agar tidak 12 SKS
	*/
	$pengecekan = $reg_uname[3] . $reg_uname[4];
	if ($pengecekan == 12)
	{
		$limitsksx = 24;
	}
	// Sampai disini saja!
	echo "<tr><td width=20%>N R P</td><td>:</td><td width=83%>$reg_uname</td></tr>";
	echo "<tr><td width=20%>N A M A</td><td>:</td><td width=83%>$namamhs</td></tr>";
	echo "<tr><td width=20%>Nilai IPS terakhir </td><td>:</td><td width=83%>$ips</td></tr>";
	echo "<tr><td>Limit SKS anda</td><td>:</td><td>$limitsksx SKS</td></tr>";
	echo "<tr><td>Toleransi SKS anda</td><td>:</td><td>$toleransi SKS</td></tr>";
	echo "<tr><td>Sisa Limit SKS anda</td><td>:</td><td>";
	echo $limitsksx+$toleransi-$sksdlmkrs;
	echo " SKS</td></tr>";
	echo "</table><td width=5%></td></tr></table>";
	echo "<br>";

	include("footer.php");
?>
	&nbsp;</td>
  </tr>
  <tr>
    <td bgcolor="7e96dc"><div align="center">copyleft ICT 2012 </div></td>
  </tr>
</table>
